<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>车队日志管理</title>
	<meta name="decorator" content="ani"/>
	<script type="text/javascript">
		var validateForm;
		var $table; // 父页面table表格id
		var $topIndex;//弹出窗口的 index
		function doSubmit(table, index){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
		  if(validateForm.form()){
			  $table = table;
			  $topIndex = index;
			  jp.loading();
			  $("#inputForm").submit();
			  return true;
		  }

		  return false;
		}

		$(document).ready(function() {
			validateForm = $("#inputForm").validate({
				submitHandler: function(form){
					jp.post("${ctx}/fleet/motorcadeLog/save",$('#inputForm').serialize(),function(data){
						if(data.success){
	                    	$table.bootstrapTable('refresh');
	                    	jp.success(data.msg);
	                    	jp.close($topIndex);//关闭dialog

	                    }else{
            	  			jp.error(data.msg);
	                    }
					})
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			
	        $('#date').datetimepicker({
				 format: "YYYY-MM-DD HH:00"
		    });
		});
	</script>
</head>
<body class="bg-white">
		<form:form id="inputForm" modelAttribute="motorcadeLog" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>	
		<table class="table table-bordered">
		   <tbody>
				<tr>
					<td class="width-15 active"><label class="pull-right"><span style="color: red">*</span>车牌号：</label></td>
					<td class="width-35">
						<sys:gridselect url="${ctx}/fleet/vehicleInformation/data" id="vehicleInformation" name="vehicleInformation.id" value="${motorcadeLog.vehicleInformation.id}" labelName="vehicleInformation.license" labelValue="${motorcadeLog.vehicleInformation.license}"
										title="车牌号选择" cssClass="form-control required" fieldLabels="名称" fieldKeys="license" searchLabels="名称" searchKeys="license" ></sys:gridselect>
					</td>
					<td class="width-15 active"><label class="pull-right"><span style="color: red">*</span>车挂号：</label></td>
					<td class="width-35">
						<sys:gridselect url="${ctx}/fleet/vehicleInformation/data" id="carRegistration" name="carRegistration.id" value="${motorcadeLog.carRegistration.id}" labelName="carRegistration.license" labelValue="${motorcadeLog.carRegistration.license}"
										title="车挂号选择" cssClass="form-control required" fieldLabels="名称" fieldKeys="license" searchLabels="名称" searchKeys="license" ></sys:gridselect>

					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right"><span style="color: red">*</span>司机：</label></td>
					<td class="width-35">
						<form:input path="driver" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right"><span style="color: red">*</span><span style="color: red">*</span>日期：</label></td>
					<td class="width-35">
						<p class="input-group">
							<div class='input-group form_datetime' id='date'>
			                    <input type='text'  name="date" class="form-control"  value="<fmt:formatDate value="${motorcadeLog.date}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
			                    <span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
			                </div>
			            </p>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">运输任务：</label></td>
					<td class="width-35">
						<form:select path="transportationMission" class="form-control ">
							<form:options items="${fns:getDictList('trsport_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>

					</td>
					<td class="width-15 active"><label class="pull-right"><span style="color: red">*</span>金额(元)：</label></td>
					<td class="width-35">
						<form:input path="money" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">货物描述：</label></td>
					<td class="width-35">
						<form:select path="cargoDescribe" class="form-control ">
							<form:options items="${fns:getDictList('goods_describ')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
						<%--<form:input path="cargoDescribe" htmlEscape="false"    class="form-control "/>--%>
					</td>
					<td class="width-15 active"><label class="pull-right">总数量：</label></td>
					<td class="width-35">
						<form:input path="totalQuantity" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">总毛重(吨)：</label></td>
					<td class="width-35">
						<form:input path="grossWeight" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">起运地：</label></td>
					<td class="width-35">
						<form:select path="startShipment" class="form-control ">
							<form:options items="${fns:getDictList('start')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>

					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">目的地：</label></td>
					<td class="width-35">
						<form:select path="destination" class="form-control ">
							<form:options items="${fns:getDictList('arrive')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>

					</td>
					<td class="width-15 active"><label class="pull-right">运输货物类型：</label></td>
					<td class="width-35">
						<form:select path="cargoType" class="form-control ">
							<form:options items="${fns:getDictList('trsport_goods')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>

					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">里程：</label></td>
					<td class="width-35">
						<form:input path="mileage" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">交款对象：</label></td>
					<td class="width-35">
						<form:input path="paymentObject" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">合同号：</label></td>
					<td class="width-35">
						<form:input path="contractNumber" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">停驶说明（地点，原因）：</label></td>
					<td class="width-35">
						<form:input path="downExplain" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">趟数：</label></td>
					<td class="width-35">
						<form:input path="count" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">备注信息：</label></td>
					<td class="width-35">
						<form:input path="remarks" htmlEscape="false"     class="form-control "/>
					</td>
				</tr>
		 	</tbody>
		</table>
	</form:form>
</body>
</html>